
<% form_remote_for :comment, :url => comments_path, :loading => "$('loadcomment').show()" do |f| -%>
  <%= f.text_area(:message, :class => 'textfield') %>
  <script type="text/javascript" charset="utf-8">
    var comment_message = new LiveValidation('comment_message', {onlyOnSubmit: true, validMessage: " " });
    comment_message.add( Validate.Presence, {failureMessage: "No puede estar vacío"} )
  </script>
  
  <%= f.hidden_field(:user_id, :value => current_user.id) %>
  <%= f.hidden_field(:event_id, :value => @event.id ) %>
  <p class="col1_2">También puedes comentar sobre este evento enviando <strong>EVE<%= @event.id %> tu comentario</strong> al <strong>638444926</strong>.</p>
  <p class="col2_2 right">
    <%= submit_tag 'Comenta', :class => 'yellowbutton', :onclick => "this.disabled = true" %>
    <%= image_tag 'ajaxload.gif', {:id => 'loadcomment', :style => "display:none"} %>
  </p>
  
<% end -%>
<div class="separata"></div>
<ul class="comments clearfix">
<% @event.comments[0..9].each do |comment| %>
  <li class="clearfix" id="<%= comment.id %>">
    <div class="commentbox">
      <div class="cont">
        <%= simple_format comment.message %>
      </div>
    </div>
    <%= image_tag comment.avatar(:thumb), :class=>"avatar" %>
    <p class="date"><%= "por #{link_to comment.user.public_name, user_home_url(comment.user.login)} <br/>" unless comment.user.nil?%><%= comment.created_at.long %> - <%= link_to 'permalink', event_url(@event)+"##{comment.id}" %></p>
  </li>
<% end %>
</ul>
<p class="right"><%= link_to 'Ver todos los comentarios', {} if @event.comments.size > 10%></p>
